home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / memory / calloc.c next >
C/C++ Source or Header  |  1997-09-09  |  440b  |  28 lines

  1.  
  2. /*
  3.  *  CALLOC.C
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  *
  9.  *  calloc(elmsize, elms)
  10.  */
  11.  
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15. void *
  16. calloc(elmSize, elms)
  17. size_t elmSize;
  18. size_t elms;
  19. {
  20.     void *ptr;
  21.     long bytes = elmSize * elms;
  22.  
  23.     if (ptr = malloc(bytes))
  24.     clrmem(ptr, bytes);
  25.     return(ptr);
  26. }
  27.  
  28.